<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Add Supplier</title>
</head>
<body>
	<form:form method="post" modelAttribute="itemDistributedListForm"
		id="addItemDistributedForm">
		<table class="table1">
			<tr>
				<td >Sr. No.</td>
				<td >BILL NUMBER</td>
				<td >ITEM</td>
				<td >NO. OF UNITS</td>
				<td >DENOMINATION</td>
				<td >MEASURING UNIT</td>
				<td >PRICE PER UNIT</td>
				<td >RETAILER</td>
				<td >TOTAL (TAXES EXCLUSIVE)</td>
				<td >TAXES</td>
				<td >TOTAL (TAXES INCLUSIVE)</td>
				<td >MONTH</td>
				<td >YEAR</td>
			</tr>
			<c:forEach items="${itemDistributedListForm.itemDistributedList}" var="itemDistributed"
				varStatus="i">
				<tr>
					<td align="center">${i.count}</td>
					<td><form:input path="itemDistributedList[${i.index}].billNo" /></td>
					<td>
						<form:select path="itemDistributedList[${i.index}].item.itemId">
							<form:option value="0" label="-SELECT AN ITEM-"/>
							<c:forEach items="${itemsList}" var="item">
								<form:option label="${item.itemName}" value="${item.itemId}"></form:option>
							</c:forEach>
						</form:select>
					</td>
					<td>
					<form:input
							path="itemDistributedList[${i.index}].noOfUnits" />
					</td>
					
					<td>
					<form:select path="itemDistributedList[${i.index}].denomination.denominationId">
							<form:option value="0" label="-SELECT A DENOMINATION-"/>
							<c:forEach items="${denominationsList}" var="denomination">
								<form:option label="${denomination.denominationName}" value="${denomination.denominationId}"></form:option>
							</c:forEach>
					</form:select>
					
					</td>
					<td>
					
					<form:select path="itemDistributedList[${i.index}].measuringUnit.measuringUnitId">
							<form:option value="0" label="-SELECT A UNIT-"/>
							<c:forEach items="${measuringUnitsList}" var="unit">
								<form:option label="${unit.measuringUnitValue}" value="${unit.measuringUnitId}"></form:option>
							</c:forEach>
					</form:select>
					
					</td>
					
				<td>
					<form:input
							path="itemDistributedList[${i.index}].pricePerUnit" data-constraints = ""/></td>
					
					<td>
					
					<form:select path="itemDistributedList[${i.index}].retailer.retailerId">
							<form:option value="0" label="-SELECT A RETAILER-"/>
							<c:forEach items="${retailerList}" var="retailer">
								<form:option label="${retailer.retailerName}" value="${retailer.retailerId}"></form:option>
							</c:forEach>
					</form:select>
					
					</td>
					
					<td>
					<form:input
							path="itemDistributedList[${i.index}].totalWithoutTax" /></td>
							
					<td>
					<form:input
							path="itemDistributedList[${i.index}].taxes" /></td>
							
					<td>
					<form:input
							path="itemDistributedList[${i.index}].grandTotal" /></td>
					

					<td> <form:select path="itemDistributedList[${i.index}].month">
							<form:options items="${monthMap}"/>
						</form:select>
					<td><form:select path="itemDistributedList[${i.index}].year">
							<form:options items="${yearMap}"/>
						</form:select>
				</tr>
			</c:forEach>
			<tr>
				<td>&nbsp;</td>
				<td colspan="5"><input type="submit" value="SUBMIT">&nbsp;
					&nbsp;<input type="button" value="CANCEL"></td>
			</tr>
		</table>
	</form:form>
</body>
</html>